<?php
if($com->Id > 0)
{
	$buttons[0]['title'] = ucfirst($txt->getWord('proceed_to_checkout').' ');
	$buttons[0]['href'] = '/c/'.($com->getComId()+1).'/';
	$buttons[0]['onclick'] = '';
	$buttons[0]['params']['class'] = 'btn '.$shop->getSetting('checkout_btn_class');
	$buttons[0]['params']['icon'] = $theme->getIconSetPrefix().'-credit-card';
	$buttons[0]['params']['iconR'] = $theme->getIconSetPrefix().'-chevron-right';
	
	$com->setButtonsHeader($buttons);
	unset($buttons);
	
	$buttons[0]['title'] = ucfirst($txt->getWord('continue_shopping'));
	$buttons[0]['href'] = '/';
	$buttons[0]['onclick'] = '';
	$buttons[0]['params']['icon'] = $theme->getIconSetPrefix().'-chevron-left';
	
	$buttons[1]['title'] = ucfirst($txt->getWord('proceed_to_checkout').' ');
	$buttons[1]['href'] = '/c/'.($com->getComId()+1).'/';
	$buttons[1]['onclick'] = '';
	$buttons[1]['params']['class'] = 'btn '.$shop->getSetting('checkout_btn_class');
	$buttons[1]['params']['icon'] = $theme->getIconSetPrefix().'-credit-card';
	$buttons[1]['params']['iconR'] = $theme->getIconSetPrefix().'-chevron-right';
	
	$com->setButtonsFooter($buttons);
	unset($buttons);
?>
<?php require(COMPONENTS_PATH.'common/com_top.php'); ?>
<?php 
$items = $cart->getCartItems(); 
?><br />
    <form id="cart_edit" name="cart_edit" method="post" action="">
	<table align="left" cellpadding="0" cellspacing="0" border="0" width="100%" class="zebra table table-condensed table-striped">
    	<thead>
        	<tr>
                <th class="text-left"><?php echo ucfirst($txt->getWord('product_description')); ?><br /></th>
                <th class="text-right"><?php echo ucfirst($txt->getWord('price')); ?><br /></th>
                <th class="text-right"><?php echo $txt->getWord('vat'); ?><br /></th>
                <th class="text-right"><?php echo ucfirst($txt->getWord('count')); ?><br /></th>
                <th>&nbsp;<br /></th>
                <th class="text-right"><?php echo ucfirst($txt->getWord('total')); ?><br /></th>
                <th>&nbsp;<br /></th>
                <?php if($shop->getGlobalSetting('use_dim_shipping_calculation')): ?>
                <th class="text-right"><?php echo ucfirst($txt->getWord('weight')); ?><br /></th>
                <th class="text-right"><?php echo ucfirst($txt->getWord('volume')); ?><br /></th>
                <?php endif; ?>
                <th class="text-center"><?php echo ucfirst($txt->getWord('delete')); ?><br /></th>
            </tr>
        </thead>
        <tbody>
    	<?php 
		if($items)
		{
			foreach($items as $item)
			{
				$bryllupskake = false;
				if(($shop->getSiteId() == 20) && (($item->getProductId() == 31) || ($item->getProductId() == 32) || (($item->getProductId() > 17) && ($item->getProductId() < 24))))
				{ $bryllupskake = true; }
				?>
				<tr>
                    <td class="text-left">
                    	<input name="cart_item[]" value="<?php echo $item->getId(); ?>" type="hidden" />
                        <a href="/p/<?php echo $item->getProductId(); ?>"><?php echo $item->getItemTitle(); ?></a>
						<?php if(($item->getItemVarTitle() != '') && ($item->getItemVarTitle() != 'Standard')) echo '&nbsp;&nbsp;'.$item->getItemVarTitle(); ?>
                        <?php echo '<br />'.ucfirst($txt->getWord('product_number')); ?>:<?php echo $item->getItemIdentity(); ?>
                        <?php 
						if($item->getItemText() != '')
						{ echo '<br />'.ucfirst($txt->getWord('text')).': '.$item->getItemText(); }
						if($item->getItemImage() != '')
						{ 
							?>
                            <br />
                            <?php echo ucfirst($txt->getWord('image')); ?> p&aring; kaken <br />
							<a class="fancyBox" href="<?php echo $item->getItemImageUrl(CART_URL, 0) ?>"><img src="<?php echo $item->getItemImageUrl(CART_URL, (count($thumb['CART'])-1)); ?>" /></a>
                            <?php
						}
						?>
						<br />
                    </td>
					<td class="text-right"><?php echo number_format($item->getSingleItemPrice(2),2,',',' '); ?> kr.</td>
					<td class="text-right"><?php echo number_format($item->getSingleItemTax(2),2,',',' '); ?> kr.</td>
                    <?php if($bryllupskake): ?>
                    <td class="text-right">
                    	<input type="hidden" name="ic[]" value="<?php echo $item->getCount(); ?>" />
                    	<input disabled="disabled" class="number" size="2" maxlength="4" type="text" name="ic_shaddow" value="<?php echo $item->getCount(); ?>" />
                    </td>
                    <?php else: ?>
					<td class="text-right"><input class="number ic input-mini" size="2" maxlength="4" type="text" name="ic[]" value="<?php echo $item->getCount(); ?>" /></td>
                    <?php endif; ?>
                    <td class="text-left">&nbsp;<a href="#" title="<?php echo ucfirst($txt->getWord('update')); ?>" class="btn btn-default btn-sm"><i class="<?php echo $theme->getIconSetPrefix(); ?>-refresh icon refresh"></i></a></td>
					<td valign="top" class="right"><?php echo number_format($item->getTotalItemPriceTotal(1),2,',',' '); ?> kr.</td>
                    <td>&nbsp;</td>
                    <?php if($shop->getGlobalSetting('use_dim_shipping_calculation')): ?>
                    <td valign="top" class="right"><?php echo $item->getTotalItemGrosWeight().'&nbsp;'.$item->getItemWeightUnit(); ?></td>
                    <td valign="top" class="right"><?php echo $item->getTotalItemVolume().'&nbsp;'.$item->getItemDimUnit(); ?>&sup3;</td>
                    <?php endif; ?>
                    <td valign="top" class="center">
                    <?php if($bryllupskake): ?>&nbsp;
                    <?php else: ?>
						<button class="btn btn-danger" name="cart_item_delete" value="0" onclick="deleteCartItem('<?php echo $item->getId(); ?>');"><i class="fa fa-minus-circle"></i></button>
                    <?php endif; ?></td>
				</tr>
            <?php 
			}
			?>
            	<tr>
                	<td colspan="8">&nbsp;</td>
                    <?php if($shop->getGlobalSetting('use_dim_shipping_calculation')): ?>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <?php endif; ?>
                    <td>&nbsp;</td>
            	</tr>
        	</tbody>
            <tfoot>
                <tr>
                    <td class="center first bold" style="padding:10px 0px;">
                        <input id="delete_cart_item" name="dci" type="hidden" value="0" />
                        <input id="com_empty_cart" name="empty_cart" value="0" type="hidden" />
                    </td>
                    <td class="underline right" style="padding:10px 0px;"><?php echo number_format($cart->getAllItemsPrice(2),2,',',' '); ?> kr.</td>
                    <td class="underline right" style="padding:10px 0px;"><?php echo number_format($cart->getAllItemsVat(2),2,',',' '); ?> kr.</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td class="last underline right" style="padding:10px 0px;"><?php echo number_format($cart->getAllItemsTotal(1),2,',',' '); ?> kr.</td>
                    <td>&nbsp;</td>
                    <?php if($shop->getGlobalSetting('use_dim_shipping_calculation')): ?>
                    <td></td>
                    <td></td>
                    <?php endif; ?>
                    <td valign="top" class="center">
                    	<a class="btn btn-danger" id="empty_cart_button" title="<?php echo ucfirst($txt->getWord('empty_cart')); ?>"><i class="fa fa-trash-o"></i></a>
                        <?php /*
                    <input name="cart_items_empty" type="image" src="<?php echo SYSICONS_URL; ?>cancel_22.gif" value="0"
                        	onmousedown="jQuery('form#cart_edit').submit();" 
                            onmouseover="jQuery('input#com_empty_cart').val(1);" 
                            onclick="cart_form.submit();" /> */ ?>
                    </td>
                </tr>
            </tfoot>
        <?php
		}
		?>
	</table>
    </form>
    <script type="text/javascript">
		function deleteCartItem(id)
		{
			jQuery('input#delete_cart_item').val(id);
			jQuery('form#cart_edit').submit(); 
		}
		
		jQuery('#empty_cart_button').click(function()
		{ 
			jQuery('#com_empty_cart').val(1);
			jQuery('form#cart_edit').submit(); 
		});
		
		jQuery('input.ic').change(function()
		{ jQuery('form#cart_edit').submit(); });
		
		jQuery('input.refresh').click(function()
		{ jQuery('form#cart_edit').submit(); });
	</script>
<?php require(COMPONENTS_PATH.'common/com_bot.php'); } ?>